namespace B.S.BasicData.EroorCode
{
    public class ApiPaging<T>
    {
        public ApiResultCode Code { get; set; } // 状态码
        public string Message { get; set; } // 提示信息
        public int Total { get; set; } // 总条数
        public int Page { get; set; } // 当前页码
        public int PageSize { get; set; } // 每页数量
        public T Data { get; set; } // 分页数据

        public ApiPaging() { }

        public ApiPaging(ApiResultCode code, string message, int total, int page, int pageSize, T data)
        {
            Code = code;
            Message = message;
            Total = total;
            Page = page;
            PageSize = pageSize;
            Data = data;
        }

        public static ApiPaging<T> Success(T data, int total, int page, int pageSize, string message = "成功")
        {
            return new ApiPaging<T>(ApiResultCode.Success, message, total, page, pageSize, data);
        }

        public static ApiPaging<T> Fail(string message = "失败", ApiResultCode code = ApiResultCode.Error)
        {
            return new ApiPaging<T>(code, message, 0, 1, 10, default(T));
        }
    }
} 